package edu.nf.utils.handler;

import edu.nf.utils.RowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

public class BeanListHandler<T> extends AbstractListHandler<T>{

    private Class<T> beanClazz;

    public BeanListHandler(Class<T> beanClazz){
        this.beanClazz = beanClazz;
    }

    @Override
    protected T getRow(ResultSet rs) throws SQLException {
        return rs.next()? RowProcessor.toBean(rs,beanClazz):null;
    }
}
